//
//  RMMPayResultView.m
//  Romomo
//
//  Created by puman on 2017/2/20.
//  Copyright © 2017年 mazegong. All rights reserved.
//

#import "RMMPayResultView.h"

@implementation RMMPayResultView
{
    UILabel *_moneyLabel;
    UILabel *_nameLabel;
}
- (instancetype)initWithFrame:(CGRect)frame{
    if ([super initWithFrame:frame]) {
        self.backgroundColor = kCColor;
        UIButton *button = [UIButton buttonWithType:(UIButtonTypeCustom)];
        button.frame = CGRectMake(0, 0, kScreenWideth, 54);
        [button setImage:[UIImage imageNamed:@"选中@3x"] forState:(UIControlStateNormal)];
        [button setTitle:@"支付成功" forState:(UIControlStateNormal)];
        [button setTitleColor:COLORFROMCODE(0x9B9B9B, 1) forState:(UIControlStateNormal)];
        [self  addSubview:button];
        
        UIView *backView = [[UIView alloc] initWithFrame:CGRectMake(15, button.bottom, kScreenWideth - 30, 120)];
        backView.layer.masksToBounds = YES;
        backView.layer.cornerRadius = 5;
        backView.backgroundColor = kWhiteColor;
        [self addSubview:backView];
        
        _nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, backView.width, 50)];
        _nameLabel.font = kFont(14);
        _nameLabel.textColor = COLORFROMCODE(0x9B9B9B, 1);
        _nameLabel.numberOfLines = 0;
        _nameLabel.textAlignment = NSTextAlignmentCenter;
        [backView addSubview:_nameLabel];
        
        _moneyLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, _nameLabel.bottom, backView.width, 70)];
        _moneyLabel.font = kFont(28);
        _moneyLabel.textAlignment = NSTextAlignmentCenter;
        [backView addSubview:_moneyLabel];
        
        _doneBut = [UIButton buttonWithType:(UIButtonTypeCustom)];
        _doneBut.frame = CGRectMake(kScreenWideth / 2 - 150, backView.bottom + 22, 300, 40);
        [_doneBut setTitle:@"完成" forState:(UIControlStateNormal)];
        [_doneBut setTitleColor:kWhiteColor forState:(UIControlStateNormal)];
        _doneBut.layer.cornerRadius = 20;
        _doneBut.backgroundColor = kBasicColor;
        [self  addSubview:_doneBut];
    }
    return self;
}
- (void)setTitelName:(NSString *)titelName{
    _nameLabel.text = [NSString stringWithFormat:@"%@ 付款金额",titelName];
}
- (void)setPrice:(NSString *)price{
    _moneyLabel.text = [NSString stringWithFormat:@"¥ %@",price];
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
